package com.cloud.netty.handler;

import com.sun.corba.se.impl.interceptors.PICurrent;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @program: netty
 * @description:
 * @author: Cloud
 * @create: 2022/4/13 11:21:26
 */
public class MyClientInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        // 加入一个出站的handler 对数据进行一个编码
        pipeline.addLast(new MyLongToByte());

        // 加入自定义的解码器
        pipeline.addLast(new MyClientByteToLong());

        //加入一个自定义的handler 处理业务
        pipeline.addLast(new MyClientHandler());

    }
}
